package com.kele.base.feign;

import com.kele.base.entity.BaseEntity;
import com.kele.base.response.Result;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.io.Serializable;
import java.util.Set;

public interface BaseFeign<ENTITY extends BaseEntity<ID>, ID extends Serializable> {
    @GetMapping("/{id:\\d+}")
    Result<ENTITY> getById(@PathVariable("id") ID id);

    @PostMapping()
    Result<ID> add(@Validated @RequestBody ENTITY param);

    @PutMapping()
    Result<ID> edit(@Validated @RequestBody ENTITY param);

    @DeleteMapping("/{id:\\d+}")
    Result<Void> delete(@PathVariable("id") ID id);

    @DeleteMapping("/batch")
    Result<Void> deleteBatch(@RequestBody Set<ID> idList);
}
